﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Ivs.Core.Data;
using Resources;

namespace SketchTour.Common
{
    public static class CMessage
    {
        /// <summary>
        /// Display error message after delete database
        /// </summary>
        /// <param name="iReturnCode"></param>
        public static string DisplayMessageDeleted(int iReturnCode)
        {
            string strReturn = string.Empty;
            switch (iReturnCode)
            {
                case CommonData.DbReturnCode.Succeed:
                    //DisplayMessage("CMN005", CommonData.MessageType.Ok);
                    strReturn = Resource.Common_MGS_CMN005;
                    break;
                case CommonData.DbReturnCode.AccessDenied:
                    //DisplayMessage("CMN017", CommonData.MessageType.Ok);
                    strReturn = Resource.Common_MGS_CMN017;
                    break;
                case CommonData.DbReturnCode.InvalidHost:
                    //DisplayMessage("CMN018", CommonData.MessageType.Ok);
                    //MessageBox.Show("Invalid Host");
                    strReturn = Resource.Common_MGS_CMN018;
                    break;
                case CommonData.DbReturnCode.InvalidDatabase:
                    //DisplayMessage("CMN019", CommonData.MessageType.Ok);
                    //MessageBox.Show("Invalid Database");
                    strReturn = Resource.Common_MGS_CMN019;
                    break;
                case CommonData.DbReturnCode.LostConnection:
                    //DisplayMessage("CMN020", CommonData.MessageType.Ok);
                    //MessageBox.Show("Lost Connection");
                    strReturn = Resource.Common_MGS_CMN020;
                    break;
                case CommonData.DbReturnCode.DuplicateKey:
                    //DisplayMessage("CMN014", CommonData.MessageType.Ok);
                    //MessageBox.Show("Duplicate Key");
                    strReturn = Resource.Common_MGS_CMN014;
                    break;
                case CommonData.DbReturnCode.ForgeignKeyNotExist:
                    //DisplayMessage("CMN022", CommonData.MessageType.Ok);
                    //MessageBox.Show("Forgeign Key Not Exist");
                    strReturn = Resource.Common_MGS_CMN022;
                    break;
                case CommonData.DbReturnCode.ForeignKeyViolation:
                    //DisplayMessage("CMN023", CommonData.MessageType.Ok);
                    //MessageBox.Show("Foreign Key Violation");
                    strReturn = Resource.Common_MGS_CMN023;
                    break;
                case CommonData.DbReturnCode.DataNotFound:
                    //DisplayMessage("CMN024", CommonData.MessageType.Ok);
                    //MessageBox.Show("Data Not Found");
                    strReturn = Resource.Common_MGS_CMN024;
                    break;
                case CommonData.DbReturnCode.ExceptionOccured:
                    //DisplayMessage("CMN025", CommonData.MessageType.Ok);
                    //MessageBox.Show("Exception Occured");
                    strReturn = Resource.Common_MGS_CMN025;
                    break;
            }
            return strReturn;
        }

        /// <summary>
        /// Display error message after Update database
        /// </summary>
        /// <param name="iReturnCode"></param>
        public static string DisplayMessageUpdated(int iReturnCode)
        {
            string strReturn = string.Empty;
            switch (iReturnCode)
            {
                case CommonData.DbReturnCode.Succeed:
                    //DisplayMessage("CMN004", CommonData.MessageType.Ok);
                    strReturn = Resource.Common_MGS_CMN004;
                    break;
                case CommonData.DbReturnCode.AccessDenied:
                    //DisplayMessage("CMN017", CommonData.MessageType.Ok);
                    strReturn = Resource.Common_MGS_CMN017;
                    break;
                case CommonData.DbReturnCode.InvalidHost:
                    //DisplayMessage("CMN018", CommonData.MessageType.Ok);
                    strReturn = Resource.Common_MGS_CMN018;
                    //MessageBox.Show("Invalid Host");
                    break;
                case CommonData.DbReturnCode.InvalidDatabase:
                    //DisplayMessage("CMN019", CommonData.MessageType.Ok);
                    //MessageBox.Show("Invalid Database");
                    strReturn = Resource.Common_MGS_CMN019;
                    break;
                case CommonData.DbReturnCode.LostConnection:
                    //DisplayMessage("CMN020", CommonData.MessageType.Ok);
                    //MessageBox.Show("Lost Connection");
                    strReturn = Resource.Common_MGS_CMN020;
                    break;
                case CommonData.DbReturnCode.DuplicateKey:
                    //DisplayMessage("CMN014", CommonData.MessageType.Ok);
                    //MessageBox.Show("Duplicate Key");
                    strReturn = Resource.Common_MGS_CMN014;
                    break;
                case CommonData.DbReturnCode.ForgeignKeyNotExist:
                    //DisplayMessage("CMN022", CommonData.MessageType.Ok);
                    //MessageBox.Show("Forgeign Key Not Exist");
                    strReturn = Resource.Common_MGS_CMN022;
                    break;
                case CommonData.DbReturnCode.ForeignKeyViolation:
                    //DisplayMessage("CMN023", CommonData.MessageType.Ok);
                    //MessageBox.Show("Foreign Key Violation");
                    strReturn = Resource.Common_MGS_CMN023;
                    break;
                case CommonData.DbReturnCode.DataNotFound:
                    //DisplayMessage("CMN024", CommonData.MessageType.Ok);
                    //MessageBox.Show("Data Not Found");
                    strReturn = Resource.Common_MGS_CMN024;
                    break;
                case CommonData.DbReturnCode.ExceptionOccured:
                    //DisplayMessage("CMN025", CommonData.MessageType.Ok);
                    //MessageBox.Show("Exception Occured");
                    strReturn = Resource.Common_MGS_CMN025;
                    break;
            }
            return strReturn;
        }
        /// <summary>
        /// Display error message after insert database
        /// </summary>
        /// <param name="iReturnCode"></param>
        public static string DisplayMessageInserted(int iReturnCode)
        {
            string strReturn = "";
            switch (iReturnCode)
            {

                case CommonData.DbReturnCode.Succeed:
                    //DisplayMessage("CMN003", CommonData.MessageType.Ok);
                    strReturn = Resource.Common_MGS_CMN003;
                    break;
                case CommonData.DbReturnCode.AccessDenied:
                    //DisplayMessage("CMN017", CommonData.MessageType.Ok);
                    strReturn = Resource.Common_MGS_CMN017;
                    break;
                case CommonData.DbReturnCode.InvalidHost:
                    //DisplayMessage("CMN018", CommonData.MessageType.Ok);
                    //MessageBox.Show("Invalid Host");
                    strReturn = Resource.Common_MGS_CMN018;
                    break;
                case CommonData.DbReturnCode.InvalidDatabase:
                    //DisplayMessage("CMN019", CommonData.MessageType.Ok);
                    //MessageBox.Show("Invalid Database");
                    strReturn = Resource.Common_MGS_CMN019;
                    break;
                case CommonData.DbReturnCode.LostConnection:
                    //DisplayMessage("CMN020", CommonData.MessageType.Ok);
                    //MessageBox.Show("Lost Connection");
                    strReturn = Resource.Common_MGS_CMN020;
                    break;
                case CommonData.DbReturnCode.DuplicateKey:
                    //DisplayMessage("CMN014", CommonData.MessageType.Ok);
                    //MessageBox.Show("Duplicate Key");
                    strReturn = Resource.Common_MGS_CMN014;
                    break;
                case CommonData.DbReturnCode.ForgeignKeyNotExist:
                    //DisplayMessage("CMN022", CommonData.MessageType.Ok);
                    //MessageBox.Show("Forgeign Key Not Exist");
                    strReturn = Resource.Common_MGS_CMN022;
                    break;
                case CommonData.DbReturnCode.ForeignKeyViolation:
                    //DisplayMessage("CMN023", CommonData.MessageType.Ok);
                    //MessageBox.Show("Foreign Key Violation");
                    strReturn = "Succeed";
                    break;
                case CommonData.DbReturnCode.DataNotFound:
                    //DisplayMessage("CMN024", CommonData.MessageType.Ok);
                    //MessageBox.Show("Data Not Found");
                    strReturn = Resource.Common_MGS_CMN024;
                    break;
                case CommonData.DbReturnCode.ExceptionOccured:
                    //DisplayMessage("CMN025", CommonData.MessageType.Ok);
                    //MessageBox.Show("Exception Occured");
                    strReturn = Resource.Common_MGS_CMN025;
                    break;
            }
            return strReturn;
        }

        /// <summary>
        /// Display error message after search
        /// </summary>
        /// <param name="iReturnCode"></param>
        //public static void DisplayMessageSearch(int iReturnCode)
        //{
        //    switch (iReturnCode)
        //    {
        //        case CommonData.DbReturnCode.AccessDenied:
        //            DisplayMessage("CMN017", CommonData.MessageType.Ok);
        //            //MessageBox.Show("Access Denied");
        //            break;
        //        case CommonData.DbReturnCode.InvalidHost:
        //            DisplayMessage("CMN018", CommonData.MessageType.Ok);
        //            //MessageBox.Show("Invalid Host");
        //            break;
        //        case CommonData.DbReturnCode.InvalidDatabase:
        //            DisplayMessage("CMN019", CommonData.MessageType.Ok);
        //            //MessageBox.Show("Invalid Database");
        //            break;
        //        case CommonData.DbReturnCode.LostConnection:
        //            DisplayMessage("CMN020", CommonData.MessageType.Ok);
        //            //MessageBox.Show("Lost Connection");
        //            break;
        //        case CommonData.DbReturnCode.DuplicateKey:
        //            DisplayMessage("CMN014", CommonData.MessageType.Ok);
        //            //MessageBox.Show("Duplicate Key");
        //            break;
        //        case CommonData.DbReturnCode.ForgeignKeyNotExist:
        //            DisplayMessage("CMN022", CommonData.MessageType.Ok);
        //            //MessageBox.Show("Forgeign Key Not Exist");
        //            break;
        //        case CommonData.DbReturnCode.ForeignKeyViolation:
        //            DisplayMessage("CMN023", CommonData.MessageType.Ok);
        //            //MessageBox.Show("Foreign Key Violation");
        //            break;
        //        case CommonData.DbReturnCode.DataNotFound:
        //            DisplayMessage("CMN024", CommonData.MessageType.Ok);
        //            //MessageBox.Show("Data Not Found");
        //            break;
        //        case CommonData.DbReturnCode.ExceptionOccured:
        //            DisplayMessage("CMN025", CommonData.MessageType.Ok);
        //            //MessageBox.Show("Exception Occured");
        //            break;
        //    }

        //}
    }
}